package financial.sharing.center.common.enums;

/**
 * @ClassName ResponseContext
 * @Description TODO
 * @Author guoyuhang
 * @ @csdn https://blog.csdn.net/qq_40788718
 * @Date 2021/4/22
 * @Version 1.0
 */
public enum ResponseContext {

    成功("成功", 0),
    创建失败("创建失败", 1),
    更新失败("更新失败", 2),
    删除失败("删除失败", 3),
    已经存在("已经存在",4),
    计提不存在("计提不存在",5),
    计提操作状态不符合("计提操作状态不符合", 6);

    private String name;
    private Integer value;

    ResponseContext(String name, Integer value){
        this.value = value;
        this.name = name;
    }


    public String getName() {
        return this.name;
    }

    public Integer getValue() {
        return this.value;
    }

    public static ResponseContext name2Enum(String value) {
        for (ResponseContext enumName : ResponseContext.values()) {
            if(enumName.getName().equals(value)) {
                return enumName;
            }
        }
        return null;
    }

    public static ResponseContext int2Enum(Integer value) {
        for (ResponseContext enumName : ResponseContext.values()) {
            if(enumName.getValue().equals(value)) {
                return enumName;
            }
        }
        return null;
    }

}
